class @FriendsListingView extends ScrollPagingView

    initialize:->
        super
        @setElement("#main")
        @model.bind("change",@render)
        @model.fetch()

    render:->
        @GetTemplate(SiteMap.Friends.FriendsListingEmptyTemplate,(template)=>
            $(@el).html(template(@model.toJSON()))
            @startLoading()
            @renewScrolling()
        )
    startLoading: ->
        $(@el).find("div").append("<div class='scroll-loading'></div>")
        @isEnabled = false;
        $.ajax(
            type: 'POST'
            url: @model.url()
            success: (data) =>
                @model.set("Page", @model.get("Page") + 1, silent: true)
                @afterLoad(data)
                if data.length
                    @isEnabled = true
            complete: =>
                @removeScrollLoading()
        )

    afterLoad: (data) =>
        @GetTemplate(SiteMap.Friends.FriendsListingTemplate,(compiledTemplate)=>
            $(@el).find("ul.friends-listing").append(compiledTemplate(data))
            return
        )
        return